package ex4;

public class Book {
	
	private int id;
	private String title;
	private String author;
	private Reader reader;
	
	public Book(){
		
	}
	
	public Book(String title, String author) {
		
		this.title = title;
		this.author = author;
	}
	
	

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public Reader getReader() {
		return reader;
	}

	public void setReader(Reader reader) {
		this.reader = reader;
	}
	
	

	public boolean equals(Book book) {
		return title.equals(book.getTitle()) && id == book.getId();
	}

	public String toString(){
		
		System.out.print("Title: \" " + this.title + "\"  " + this.author );
		if (this.reader != null){
			System.out.print(" Reader: " + this.getReader().getName() );
		}
		return " ";
	}
	
	public boolean isAvailableBook(){
		return this.reader == null;
	}
	
	
	

}
